# 修改货期时间为7天
from utils.file_operation import load_json_to_dict, save_dict_to_json
from utils.converter import generate_groups
from rj.request import RequestHanlder
import time

temp_list_code = load_json_to_dict('temp_list_code.json')
update_list = []
rj = RequestHanlder()
for code in temp_list_code:
    update_list.append({"productNum": code, "deliveryTime": 7})

for group in generate_groups(update_list, 50):
    res = rj.updateProductInfoByCode(group)
    print(res.json())
    time.sleep(1)